
<div class='fui-page fui-page-current'>
    <div class="fui-header">
		<div class="fui-header-left">
			<a class="back" ng-click="goback()"></a>
		</div>
		<div class="title">账户充值</div> 
		<div class="fui-header-right">&nbsp;</div>
    </div>
    <div class="fui-content navbar">
		<div class='fui-cell-group'>
			<div class='fui-according'>
				<div class='fui-according-header' style="color: #666;line-height:1.2rem;padding-left:0.6rem">
					充值活动
					<div class="text" style="font-size:0.65rem;color:#666;line-height:1.2rem;padding-left:1rem">
						充值满 <span class='text-danger'>{{pagedata.credit_activitys[0].condition}}</span> 元立即送 <span class='text-danger'>{{pagedata.credit_activitys[0].money}}</span> 元
					</div>
					<span ng-if="pagedata.credit_activitys.length>1" ng-click="toogle(pagedata,'showmore');" class="remark"></span>
				</div>
				<div ng-if="pagedata.showmore" class="fui-according-content" style="display:block">
					<div class='content-block' style="padding: 0 0.6rem;">
						<div class="fui-cell-group recharge" style="margin-top: 0;">
							<div ng-repeat="item in pagedata.credit_activitys" class="fui-cell" href="javascript:;" ng-click="pagedata.item.money=item.condition">
								<div class="fui-cell-text">充值满 <span class='text-danger'>{{item.condition}}</span> 元立即送 <span class='text-danger'>{{item.money}}</span> 元</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class='fui-cell-group'>
			<div class='fui-cell'>
				<div class='fui-cell-label'>当前余额</div>
				<div class='fui-cell-info c000'>￥{{pagedata.item.credit2}}</div>
			</div>
			<div class='fui-cell'>
				<div class='fui-cell-label'>充值金额</div>
				<div class="fui-cell-info c000" style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;">￥ <input class='fui-input' placeholder="输入充值金额" id='money' ng-model="pagedata.item.money"></div>
			</div>
		</div>
		<div class="fui-cell-group">
			<div ng-repeat="item in pagedata.coupons" class="fui-cell">
				<div class='fui-cell-label'>充值券</div>
				<div class='fui-cell-info subtitle' style="font-size:0.65rem" href="javascript:;" ng-click="pagedata.item.money=item.coupon.enough">
					<span>满 <span class="red">{{item.coupon.enough}} </span>元 送</span> 
					<span ng-if="item.coupon.backmoney"><span class="red">{{item.coupon.backmoney}} </span><span class="threetitle">元余额</span></span>
					<span ng-if="item.coupon.backcredit"><span class="red">{{item.coupon.backcredit}} </span><span class="threetitle">积分</span></span>
					<span ng-if="item.coupon.backredpack"><span class="red">{{item.coupon.backredpack}} </span><span class="threetitle">元红包</span></span>
				</div>
				<div class="fui-cell-remark" ng-click="toogle(pagedata,'showcouponmore');">
					<div ng-if="pagedata.coupons.length>1" class="badge">{{pagedata.coupons.length}}</div>
					<span ng-if="pagedata.coupons.length<=0" class='text'>无可用</span>
				</div>
			</div>
			<div ng-if="pagedata.showcouponmore" class="fui-according-content" style="display:block">
					<div class='content-block' style="padding: 0 0.6rem;">
						<div class="fui-cell-group recharge" style="margin-top: 0;">
							<div ng-repeat="item in pagedata.coupons" class="fui-cell" href="javascript:;" ng-click="pagedata.item.money=item.coupon.enough">
								<div class="fui-cell-text">
								<span>满 <span class="red">{{item.coupon.enough}} </span>元 送</span> 
								<span ng-if="item.coupon.backmoney"><span class="red">{{item.coupon.backmoney}} </span><span class="threetitle">元余额</span></span>
								<span ng-if="item.coupon.backcredit"><span class="red">{{item.coupon.backcredit}} </span><span class="threetitle">积分</span></span>
								<span ng-if="item.coupon.backredpack"><span class="red">{{item.coupon.backredpack}} </span><span class="threetitle">元红包</span></span>
								</div>
							</div>
						</div>
					</div>
			</div>
			<div ng-if="pagedata.coupons.length<1" class="fui-cell">
				<div class='fui-cell-label'>充值券</div>
				<div class='fui-cell-info subtitle' style="font-size:0.65rem">
				</div>
				<div class="fui-cell-remark" ng-click="toogle(pagedata,'showcouponmore');">
					<span class='text'>无可用</span>
				</div>
			</div>
		</div>
		<a href="javascript:;" class='btn btn-success block' ng-click="pagedata.recharge()">确认充值</a>
</div>
<script>
scope.pagedata.recharge=function(){
	scope.post_json('recharge',scope.pagedata.item,function(pay_id){
		console.log('pay_id');console.log(pay_id);
		require(['tool'],function(tool){
			tool.pay(pay_id,function(res){
				console.log('收到支付结果！');
				if(res.type=='success'){
					scope.message('充值成功！','','goback');
				}else{
					scope.message('充值失败！'+res.message,'','goback');
				}
			});
		});
	});
}
</script>